// Commands

Assault.Commands = {}

// Change level

function Assault.Commands.ChangeLevel(Player, Command, Args)
	local Gamemode = Assault.Gamemode.Active
	
	// Check gamemode
	
	if (Gamemode) then
		local Level = table.concat(Args, " ")
		
		// Check
		
		local Check = Assault.Level.Load(Level)
		
		// Message
		
		if (!Check) then
			Assault.Game.Print("The level '"..Level.."' does not exist!")
		else
			Assault.Gamemode.Load(Gamemode.ID)
		end
	else
		Assault.Game.Print("You are not running a gamemode!")
	end
end

concommand.Add("assault_changelevel", Assault.Commands.ChangeLevel)

// Change gamemode

function Assault.Commands.ChangeGamemode(Player, Command, Args)
	local Gamemode = table.concat(Args, " ")
	
	// Check
	
	local Check = Assault.Gamemode.Load(Gamemode)
	
	// Message
	
	if (!Check) then
		Assault.Game.Print("The gamemode '"..Gamemode.."' does not exist!")
	end
end

concommand.Add("assault_changegamemode", Assault.Commands.ChangeGamemode)

// Quit

function Assault.Commands.Quit(Player, Command, Args)
	local Gamemode = Assault.Gamemode.Active
	
	// Check gamemode
	
	if (Gamemode) then
		Assault.Gamemode.Unload()
	else
		Assault.Game.Print("You are not running a gamemode!")
	end
end

concommand.Add("assault_quit", Assault.Commands.Quit)

// Pause

function Assault.Commands.Pause(Player, Command, Args)
	// Check
	
	local Check = Assault.Level.Loaded
	
	// Message
	
	if (!Check) then
		Assault.Game.Print("You do not have a level loaded!")
	else
		Assault.Gamemode.Paused = !Assault.Gamemode.Paused
	end
end

concommand.Add("assault_pause", Assault.Commands.Pause)